import request from "@/utils/request";
import type { TenantPkgForm, TenantPkgQuery, TenantPkgVO } from "./types";
import type { AxiosPromise } from "axios";

// 查询租户套餐列表
export function listTenantPackage(query?: TenantPkgQuery): AxiosPromise<TenantPkgVO[]> {
  return request({
    url: "/system/tenantPackage/list",
    method: "get",
    params: query
  });
}

// 查询租户套餐下拉选列表
export function selectTenantPackage(): AxiosPromise<TenantPkgVO[]> {
  return request({
    url: "/system/tenantPackage/selectList",
    method: "get"
  });
}

// 查询租户套餐详细
export function getTenantPackage(packageId: string | number): AxiosPromise<TenantPkgVO> {
  return request({
    url: "/system/tenantPackage/" + packageId,
    method: "get"
  });
}

// 新增租户套餐
export function addTenantPackage(data: TenantPkgForm) {
  return request({
    url: "/system/tenantPackage",
    method: "post",
    data: data
  });
}

// 修改租户套餐
export function updateTenantPackage(data: TenantPkgForm) {
  return request({
    url: "/system/tenantPackage",
    method: "put",
    data: data
  });
}

// 租户套餐状态修改
export function changePackageStatus(packageId: number | string, status: string) {
  const data = {
    packageId,
    status
  };
  return request({
    url: "/system/tenantPackage/changeStatus",
    method: "put",
    data: data
  });
}

// 删除租户套餐
export function delTenantPackage(packageId: string | number | Array<string | number>) {
  return request({
    url: "/system/tenantPackage/" + packageId,
    method: "delete"
  });
}
